package com.zhouyihe.weblog.admin.controller;

import com.zhouyihe.weblog.admin.model.vo.blogsettings.UpdateBlogSettingsReqVO;
import com.zhouyihe.weblog.admin.service.AdminBlogSettingsService;
import com.zhouyihe.weblog.common.aspect.ApiOperationLog;
import com.zhouyihe.weblog.common.utils.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName AdminBlogSettingsController
 * @author: 周益和
 * @qq: 1552951165
 * @date: 2024/6/4
 * @description: 管理员博客设置模块
 */
@RestController
@RequestMapping("/admin/blog/settings")
@Api(tags = "Admin 博客设置模块")
public class AdminBlogSettingsController {
    
    @Autowired
    private AdminBlogSettingsService blogSettingsService;
    
    /**
     * 博客基础信息修改
     * @param updateBlogSettingsReqVO
     * @return
     */
    @PostMapping("/update")
    @ApiOperation(value = "博客基础信息修改")
    @ApiOperationLog(description = "博客基础信息修改")
    public Response updateBlogSettings(@RequestBody @Validated UpdateBlogSettingsReqVO updateBlogSettingsReqVO) {
        return blogSettingsService.updateBlogSettings(updateBlogSettingsReqVO);
    }
    
    /**
     * 获取博客设置详情
     * @return
     */
    @PostMapping("/detail")
    @ApiOperation(value = "获取博客设置详情")
    @ApiOperationLog(description = "获取博客设置详情")
    public Response findDetail() {
        return blogSettingsService.findDetail();
    }
}
